﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace ZHDJ.MobileInterface
{
    /// <summary>
    /// msSSOTokenWS 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消注释以下行。 
    // [System.Web.Script.Services.ScriptService]
    public class msSSOTokenWS : System.Web.Services.WebService
    {

        [WebMethod(Description = "获取用户ID")]
        public void GetLoginID(string Token, string IP)
        {
            HttpContext.Current.Response.ContentType = "application/json;charset=utf-8";
            string result = string.Empty;
            SSOWebService ws = new SSOWebService();
            CheckTokenKeyIn inPara = new CheckTokenKeyIn();
            CheckUserInfoOut outPara = new CheckUserInfoOut();
            inPara.tokenKey = Token;
            inPara.ip = IP;
            CallResult Result = ws.SSOCheckToken(inPara, out outPara);


            string result2 = string.Empty;
            string jsoncallback = HttpContext.Current.Request["jsoncallback"];
            if (!string.IsNullOrEmpty(jsoncallback))
            {
                result2 = jsoncallback + "(" + SerializeHelper.JsonSerializer<CheckUserInfoOut>(outPara) + ")";
                HttpContext.Current.Response.Write(result2);
                HttpContext.Current.Response.End();
            }
            else
            {
                result2 = SerializeHelper.JsonSerializer<CheckUserInfoOut>(outPara);
                HttpContext.Current.Response.Write(result2);
                HttpContext.Current.Response.End();
            }
        }
    }
}
